package jc15;

import java.util.*;

public class lxjihe {
    public static void main(String[] args) {
        Map<Integer,Character> map = new HashMap<>();
        map.put(1,'a');
        map.put(2,'b');
        map.put(3,'c');
        map.put(4,'d');
        map.put(5,'e');
        map.put(6,'f');
        map.put(7,'g');
        System.out.println(map);

        System.out.println(map.size());
        System.out.println(map.isEmpty());
        System.out.println(map.containsKey(5));
        System.out.println(map.containsValue('g'));
        System.out.println(map.hashCode());
        System.out.println(map.get(5));
        System.out.println(map.remove(5));
        System.out.println(map.containsKey(6));
        System.out.println(map.containsValue('e'));
        Collection<Character> values = map.values();
        System.out.println(values);
        Set<Integer> set = map.keySet();
        Iterator<Integer> it = set.iterator();
        while (it.hasNext()){
//            it.next();
            Integer key = it.next();
            Character value = map.get(key);
            System.out.println(key+value);
        }
        Set<Map.Entry<Integer, Character>> entrySet = map.entrySet();
        Iterator<Map.Entry<Integer, Character>> it2 = entrySet.iterator();
        while(it2.hasNext()){
            Map.Entry<Integer, Character> entry = it2.next();
            Integer key = entry.getKey();
            Character value1 = entry.getValue();
            System.out.println(key+value1);
        }

        ArrayList<Object> list = new ArrayList<>();
        list.add(1456);
        list.add(145);
        list.add(156);
        list.add(456);
        System.out.println(list);
        System.out.println(list.hashCode());
        System.out.println(list.toString());
        System.out.println(list.contains(546));
        System.out.println(list.remove(2));

        Set<String> set1 = new HashSet<>();
        set1.add("紫霞仙子");
        set1.add("至尊宝");
        set1.add("孙悟空");
        set1.add("紫霞仙子");
        System.out.println(set1);
        System.out.println(set1.contains("唐僧"));
        System.out.println(set1.isEmpty());
        System.out.println(set1.remove(2));
        System.out.println(set1.size());
        System.out.println(Arrays.toString(set1.toArray()));
        System.out.println(set);

    }


}
